// ==================================================================================
// Shared Genomics Project MPI Codebase
// Version 1.0 30/04/2010
//
// (c) 2010 University of Manchester all rights reserved
//
// This file is distributed under the GNU General Public License, Version 2.  
// Please see the file COPYING.txt for more details
// ==================================================================================

#ifndef _SORT_H_
#define _SORT_H_

#ifdef __cplusplus
extern "C" {
#endif

/*!
\file
\ingroup	gio
\brief		Sorting Statistical Output
*/

/*! 
\brief Numerically sort file output
\details
	The source file must be a CSV file.<br>
	The column indices ranges from 1 to N (go figure???).<br>
	An sorted copy of the original file is placed in the same path as the source file
	but the filename is appended with the file \ref SUFFIX_SORTED_FILE.
\param [in] filepath Path to the input file
\param [in] sort_col_index Sort column index (1 to N)
\returns 1 on success or 0 on failure
*/
int sort_file(char *filepath, int sort_col_index);

/*! 
\brief Numerically sort file input file and copy output to a remote file.
\details
	The source file must be a CSV file.<br>
\param [in] localFilepath Path to the input file
\param [in] remoteFilepath Path to the output file
\param [in] colName Column name to sort on
\returns 1 on success or 0 on failure
*/
int sort_file_by_col_and_copy(char *localFilepath, char *remoteFilepath, char *colName);

#ifdef __cplusplus
}
#endif

#endif //_SORT_H_
